package com.eagle.epay.controller;


import com.eagle.epay.common.ResultVO;

import com.eagle.epay.service.IProductService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Set;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author eagle
 * @since 2019-12-21
 */
@RestController
@RequestMapping("/product")
public class ProductController {
	@Autowired
	IProductService productService;

	//http://localhost:8080/product/findById?categoryId=&pageNum=1&pageSize=3
	@GetMapping("/findById")
	public ResultVO<PageInfo> list(@RequestParam(required = false) Integer categoryId,
								   @RequestParam(required = false, defaultValue = "1") Integer pageNum,
								   @RequestParam(required = false, defaultValue = "10") Integer pageSize) {
		return productService.listProductsById(categoryId,pageNum, pageSize);
	}

}

